/**
 * API集中管理
 * @Author liyuyang
 * @Date 2020-11-25
 * @Email 15615676670@163.com
 */
export default (Vue, vm) => {
	let api = {
		
		// 用户相关
		login: (params = {}) => vm.$u.post('/login', params),
		updatePwd: (params = {}) => vm.$u.post('/updatePwd', params),
		getUserInfo: () => vm.$u.get('/getInfo'),

		// 通用
		getHouses: () => vm.$u.get('/cotes/queryHouse'),
		getCotes: houseId => vm.$u.get('/cotes/queryCote', {houseId: houseId}),
		getDictData: type => vm.$u.get('/hog/getDictData', {type: type}),
		
		// 实时数据
		queryRealtime: (params = {}) => vm.$u.post('/realtime/list', params),
		getRealtimeDetail: id => vm.$u.get('/realtime/getDetail', {id: id}),
		getHistoryList: id => vm.$u.get('/realtime/getHistoryList', {id: id}),
		
		// 舍栏管理/cotes/getCote?id=
		queryCoteTree: () => vm.$u.post('/cotes/queryTree'),
		
		getCoteById: id => vm.$u.post('/cotes/getCote', {id: id}),
		deleteCote: id => vm.$u.post('/cotes/deleteCote', {id: id}),
		addCote: (params = {}) => vm.$u.post('/cotes/addCote', params),
		editCote: (params = {}) => vm.$u.post('/cotes/editCote', params),
		
		getHouseById: id => vm.$u.post('/cotes/getHouse', {id: id}),
		deleteHouse: id => vm.$u.post('/cotes/deleteHouse', {id: id}),
		addHouse: (params = {}) => vm.$u.post('/cotes/addHouse', params),
		editHouse: (params = {}) => vm.$u.post('/cotes/editHouse', params),
		
		
		// 牲畜管理
		getHogById: id => vm.$u.post('/hog/getById', {id: id}),
		listHog: (params = {}) => vm.$u.post('/hog/list', params),
		addHog: (params = {}) => vm.$u.post('/hog/add', params),
		editHog: (params = {}) => vm.$u.post('/hog/editSave', params),
		deleteHog: id => vm.$u.post('/hog/delete', {id: id}),
		
	}
	vm.$u.api = api;
}
